package com.smart.common.transfer;

import java.util.Objects;

public enum UnitTypeEnum {
    /**
     *
     */
    JIANSHE(1, "JIANSHE_UNIT"),
    JIANLI(2, "JIANLI_UNIT"),
    ZONGBAO(3, "ZONGBAO_UNIT"),
    FENBAO(4, "FENBAO_UNIT");

    private Integer oldType;
    private String newType;

    UnitTypeEnum(Integer oldType, String newType) {
        this.oldType = oldType;
        this.newType = newType;
    }

    public Integer getOldType() {
        return oldType;
    }

    public String getNewType() {
        return newType;
    }

    public static UnitTypeEnum getNewType(Long oldType) {
        if (oldType == null) {
            return null;
        }

        for (UnitTypeEnum value : values()) {
            if (oldType.intValue() == value.getOldType()) {
                return value;
            }
        }

        return null;
    }
}
